From: Marek Marczykowski-Górecki Date: Wed, 26 Jul 2017 21:27:14 +0000 (+0200) Subject: libvchan: Fix cleanup when xc_gntshr_open failed X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~1760 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=a3a87d27a3de57ab5591d5d2604e6a5c6c806eab;p=xen.git libvchan: Fix cleanup when xc_gntshr_open failed If xc_gntshr_open failed the only thing to cleanup is free allocated memory. So instead of calling libxenvchan_close (which assume valid calculated buffers being mmaped already) free memory and return. Signed-off-by: Marek Marczykowski-Górecki Acked-by: Wei Liu --- diff --git a/tools/libvchan/init.c b/tools/libvchan/init.c index 83e1deec44..e53f3a78d2 100644 --- a/tools/libvchan/init.c +++ b/tools/libvchan/init.c @@ -329,8 +329,10 @@ struct libxenvchan *libxenvchan_server_init(struct xentoollog_logger *logger, } ctrl->gntshr = xengntshr_open(logger, 0); - if (!ctrl->gntshr) - goto out; + if (!ctrl->gntshr) { + free(ctrl); + return 0; + } if (init_evt_srv(ctrl, domain, logger)) goto out;